﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.iss.inventory.Entity;

namespace com.iss.inventory.Controllers
{
   public class DispartmentController
    {
       InvManagementEntities ime = new InvManagementEntities();
       public List<object> getDispartment(int srfID,int departmentID)
       {
           var list = (from s in ime.SRFDetails where s.SRFID==srfID && s.DeptID==departmentID select new { ItemCode = s.ItemID, StationeryDescription = s.StationeryItem.Description, RequestQty = s.QtyRequested, ActualQty = s.QtyRetrieved, UOM = s.StationeryItem.UnitofMeasure });
          return list.ToList<object>();
       }
       public int getlast(int depId)
       {
           SRFDetail list = (from s in ime.SRFDetails where s.DeptID == depId orderby s.SRFID descending select s).First();
            return Convert.ToInt32(list.SRFID);
       }

       //public List<object> geteachDidpartment(int departmentID)
       //{
       //    //var list = (from s in ime.SRFDetails where s.DeptID == departmentID group s by s.SRFID into g select new { ItemCode = g., StationeryDescription = g.StationeryItem.Description, RequestQty = g.QtyRequested, ActualQty = g.QtyRetrieved, UOM = g.StationeryItem.UnitofMeasure }).Last();
       //    return list.ToList<object>();
       //}
    }
}
